﻿using System;

namespace XamlFoundation.Foundation
{
    public static class EventExtensions
    {
        public static void Fire(this EventHandler handler, object sender, EventArgs args)
        {
            if( handler != null)
            {
                handler(sender, args);
            }
        }

        public static void Fire(this EventHandler handler, object sender)
        {
            if (handler != null)
            {
                handler(sender, EventArgs.Empty);
            }
        }

        public static void Fire<T>(this EventHandler<EventArgs<T>> handler, object sender, EventArgs<T> args)
        {
            if (handler != null)
            {
                handler(sender, args);
            }
        }
    }
}
